/*Enforcement Analysis
STATA 14
January 15, 2017
Replicates  Figure 1 from OECD and TRACE DATA*/



cd  "C:\Users\ejm5\Dropbox\Rents_Asunder\CountryofOrigin\20160315_InternationaOrganization\Replication"
use "C:\Users\ejm5\Dropbox\Rents_Asunder\CountryofOrigin\Enforcement\oecd_fines.dta", clear

#delimit cr
generate phase3=1 if year>=2010
replace phase3=0 if year<2010
collapse (sum) fine if year>=2006, by(phase3)
label var phase "After Phase 3 Enforcement Stage"
lab values phase3 phase3
label define phase3 0 "2006-2009" 1 "2010-2013"
	
#delimit;
graph bar (asis) fine , over(phase3) blabel(bar, size(medium)) ytitle("Average Penalty in Millions of USD", size(medium) margin(medium))
 title("Penalties")  scheme(s1mono);
graph save fine.gph, replace;


#delimit cr
use "C:\Users\ejm5\Dropbox\Rents_Asunder\CountryofOrigin\Enforcement\trace.dta", clear
generate total_investigations= inv_us+ inv_non
generate total_enforce= enf_us+ enf_non


#delimit cr
generate phase3=1 if year>=2010
replace phase3=0 if year<2010
collapse (sum) inv_us inv_non enf_us enf_non total* if year>=2006, by(phase3)
label var phase "After Phase 3 Enforcement Stage"
lab values phase3 phase3
label define phase3 0 "2006-2009" 1 "2010-2013"
	
#delimit;
graph bar (asis) total_inv , over(phase3) blabel(bar, size(medium)) ytitle("Number of OECD-ABC Enforcement Actions", size(medium) margin(medium))
title("Cases")  scheme(s1mono);
graph save enforce.gph, replace;

graph combine fine.gph enforce.gph, xcommon imargin(small) scheme(s1mono);
graph export Figure1.pdf, as(pdf) replace;
log close;
